
    <div class="head clearfix">
        <a href="javascript:void(0);" class="iconfont icon-zuo hide-search"></a>
        <span class="head-name">选择参会人员</span>
    </div>

    <div class="search">
        <p class="tips-text text-gray text-center"><span class='iconfont icon-sousuo'></span>搜索名字、拼音、手机号</p>
        <input class="search-input" name="search" value=""/>
    </div>

    <if condition="$data">
        <div class="lists">
            <div class="list-line">
                <span class="iconfont icon-xuanze" id="select-all-search"></span> 全选
            </div>
        </div>
        <div class="lists" id="list2">
                <foreach name="data" item="vo">
                    <div class="list-line tb-mode">
                        <div class="tb-cell check-box" data-id="{BEESCRM:$vo.user_id}"><span class="iconfont icon-xuanze" v="{BEESCRM:$vo.user_id}"></span></div>
                        <div class="tb-cell small-photo"><img src="<if condition="!empty($vo['avatar'])">{BEESCRM:$vo.avatar}<else/>/assets/meeting/images/photo.jpg</if>"/></div>
                        <div class="tb-cell">{BEESCRM:$vo.real_name}</div>
                    </div>
                </foreach>
        </div>
    <else />
        <div class="lists" id="">
            <div class="tb-cell" style="text-align:center;">暂无结果~</div>
        </div>
    </if>

    <div class="fixed-total">
        <div class="tb-mode">
            <input type="hidden" value="{BEESCRM:$edit}" id="edit">
            <div class="tb-cell"><a href="#" class="btn pull-right bg-green sure-search">确定</a></div>
        </div>
    </div>

<script type="text/javascript" src="/assets/public/seajs/sea.js"></script>
<script enter="publicjs/public" id="confnode" async="async" src="/assets/public/config.js"></script>
<script type="text/javascript" src="/assets/public/jquery-2.1.0.min.js"></script>
<script>

    $(document).on('click','.hide-search',function() {
        $(".search-result").css('display','none');
        $(".show-search").css('display','block');
    })

    $('#select-all-search').click(function(){
        if($(this).hasClass('icon-xuanze1')){ //选中
            $(this).addClass('icon-xuanze').removeClass('icon-xuanze1');
            $('#list2 .iconfont').addClass('icon-xuanze').removeClass('icon-xuanze1');
        }else{ //未选中
            $(this).addClass('icon-xuanze1').removeClass('icon-xuanze');
            $('#list2 .iconfont').addClass('icon-xuanze1').removeClass('icon-xuanze');
        }
    })

    $('#list2').on('click','.iconfont',function(){
        if($(this).hasClass('icon-xuanze1')){
            $(this).addClass('icon-xuanze').removeClass('icon-xuanze1');
        }else{
            $(this).addClass('icon-xuanze1').removeClass('icon-xuanze');
        }
        if($('#select-box .checkbox').length == $('#select-box .icon-xuanze1').length){
            $('#select-all').children('.iconfont').addClass('icon-xuanze1').removeClass('icon-xuanze');
        }else{
            $('#select-all').children('.iconfont').addClass('icon-xuanze').removeClass('icon-xuanze1');
        }
    })

    $('.sure-search').click(function(){ //确认
        var edit = $('#edit').val();
        url ="/Meeting/MeetingInvite/addInviteMeeting/step/two/";

        if(edit == 1){
            url ="/Meeting/MeetingInvite/editInviteMeeting/step/two/";
        }
        var users = $('#list2 .icon-xuanze1');

        var user_ids = {};

        for (var i = 0; i < users.length; i++) {
            user_ids[i] = parseInt($('#list2 .icon-xuanze1:eq('+i+')').attr('v'));
        }

        var data = {users:JSON.stringify(user_ids)};
        $.ajax({
            url:"/Meeting/MeetingInvite/saveByUser",
            data:data,
            type:'post',
            success:function(result){
                if(result){
                    location.href=url;
                }else{
                    fm.alert('操作失败');
                }
            }
        });
    });
</script>
